package com.coocaa.ops.admin.v1.buttonmanage;

import com.coocaa.ops.admin.base.annotation.Auth;
import com.coocaa.ops.admin.base.controller.MgrBaseController;
import com.coocaa.ops.admin.base.util.WebUtil;
import com.coocaa.ops.admin.v1.buttonmanage.model.ButtonManageModel;
import com.coocaa.ops.admin.v1.buttonmanage.service.IButtonManageService;
import com.coocaa.ops.admin.v1.buttonmanage.validator.ButtonManageValidator;
import com.coocaa.ops.common.core.base.enums.AuthEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author bijiahao
 * @date : 2018/6/14.
 * @description: 审核等按钮 前端控制器 -新平台使用
 *
 */
@RestController
@RequestMapping("/v1/buttonManage")
public class ButtonManageController extends MgrBaseController {
    @Autowired
    private IButtonManageService buttonManageService;

    /**
     * 获取审核详情相关操作按钮
     *
     * @param model
     * @param request
     * @return
     */
    @Auth(verifyAuthority = true, authorityType = AuthEnum.BROWSER)
    @RequestMapping(value = "/getAuditDetailButton",method = {RequestMethod.GET,RequestMethod.POST})
    public Object getAuditDetailButton(ButtonManageModel model, HttpServletRequest request) {
        ButtonManageValidator.valid(model, request, true);
        return buttonManageService.getAuditDetailButton(model, WebUtil.getCurrentUser(request));
    }
}
